package mskruch.gps;

import java.io.Serializable;

/**
 * A single lap of a track
 * 
 * @author Marcin Skruch
 */
public class Lap implements Serializable {
    private static final long serialVersionUID = 1L;

    /** lap points */
    private final Point[] points;
    




	private Float totalDistance;
	private Integer totalAscent;
	private Integer totalDescent;
    private Short avgCadence;
    private Short avgHeartRate;
    private Float avgSpeed;
    private Float totalElapsedTime;
    private Float totalTimerTime;
    
    
    /**
     * 
     * @param points lap points, must have at least one element
     * @param totalAscent
     * @param avgCadence
     * @param avgHeartRate
     * @param avgSpeed
     * @param totalElapsedTime
     * @param totalTimerTime
     */
    public Lap(Point[] points, Float totalDistance, Integer totalAscent, Integer totalDescent, Short avgCadence, Short avgHeartRate, Float avgSpeed,
			Float totalElapsedTime, Float totalTimerTime) {
		super();
		if (points == null || points.length == 0) {
            throw new IllegalArgumentException("a lap must have some points");
        }
		this.points = points;
		this.totalDistance = totalDistance;
		this.totalAscent = totalAscent;
		this.totalDescent = totalDescent;
		this.avgCadence = avgCadence;
		this.avgHeartRate = avgHeartRate;
		this.avgSpeed = avgSpeed;
		this.totalElapsedTime = totalElapsedTime;
		this.totalTimerTime = totalTimerTime;
		 
	}

    public Integer getTotalAscent() {
		return totalAscent;
	}

    public Float getTotalDistance() {
		return totalDistance;
	}

	public Integer getTotalDescent() {
		return totalDescent;
	}
    
	public Short getAvgCadence() {
		return avgCadence;
	}

	public Short getAvgHeartRate() {
		return avgHeartRate;
	}

	public Float getAvgSpeed() {
		return avgSpeed;
	}

	public Float getTotalElapsedTime() {
		return totalElapsedTime;
	}

	public Float getTotalTimerTime() {
		return totalTimerTime;
	}

  


    


	/**
     * @param points
     *            lap points, must have at least one element
     */
    public Lap(Point[] points) {
        this (points, null, null, null, null, null, null, null, null);
    }
    
    

    /**
     * @return lap points
     */
    public Point[] getPoints() {
        return points;
    }

}
